package com.yq.homework.day18;


/**
 * @author 3307235355@qq.com
 * @since 2022/06/18 14:22
 */
public class Demo02 {
    public static void main(String[] args) {
        Dog d1 = new Dog(12, "花花", "白");
        d1.print();
    }
}

class Dog {
    private int age;
    private String name;
    private Body b1 = new Body();

    public Dog(int age, String name, String color) {
        this.age = age;
        this.name = name;
        b1.setColor(color);
    }

    public void print() {

        System.out.println("年龄： " + age + " 名字：" + name + " 颜色：" + b1.color);
    }

    private class Body {
        private String color;

        public void setColor(String color) {
            this.color = color;
        }
    }
}
